home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Code / Video.cls < prev    next >
Text File  |  1997-06-14  |  3KB  |  130 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "CVideo"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = False
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Option Explicit
  11.  
  12. Public Enum EErrorVideo
  13.     eeBaseVideo = 13420     ' CVideo
  14. End Enum
  15.  
  16. Private hdcScreen As Long
  17.  
  18. Private Sub Class_Initialize()
  19.     hdcScreen = GetDC(hNull)
  20. End Sub
  21.  
  22. Private Sub Class_Terminate()
  23.     Call ReleaseDC(hNull, hdcScreen)
  24. End Sub
  25.  
  26. Private Function GetCaps(iCode As Long) As Long
  27.     GetCaps = GetDeviceCaps(hdcScreen, iCode)
  28. End Function
  29.  
  30. Property Get BitsPerPixel() As Long
  31.     BitsPerPixel = GetCaps(BITSPIXEL)
  32. End Property
  33.  
  34. Property Get ColorPlanes() As Long
  35.     ColorPlanes = GetCaps(PLANES)
  36. End Property
  37.  
  38. Property Get Technology() As Long
  39.     ' Windows constant TECHNOLOGY conflicts with name of property
  40.     Technology = GetCaps(Win.Technology)
  41. End Property
  42.  
  43. Property Get XPixels() As Long
  44.     XPixels = GetCaps(HORZRES)
  45. End Property
  46.  
  47. Property Get YPixels() As Long
  48.     YPixels = GetCaps(VERTRES)
  49. End Property
  50.  
  51. Property Get BrushCount() As Long
  52.     BrushCount = GetCaps(NUMBRUSHES)
  53. End Property
  54.  
  55. Property Get PenCount() As Long
  56.     PenCount = GetCaps(NUMPENS)
  57. End Property
  58.  
  59. Property Get FontCount() As Long
  60.     FontCount = GetCaps(NUMFONTS)
  61. End Property
  62.  
  63. Property Get ColorCount() As Long
  64.     ColorCount = GetCaps(NUMCOLORS)
  65. End Property
  66.  
  67. Property Get XAspect() As Long
  68.     XAspect = GetCaps(ASPECTX)
  69. End Property
  70.  
  71. Property Get YAspect() As Long
  72.     YAspect = GetCaps(ASPECTY)
  73. End Property
  74.  
  75. Property Get XYAspect() As Long
  76.     XYAspect = GetCaps(ASPECTXY)
  77. End Property
  78.  
  79. Property Get PaletteSize() As Long
  80.     PaletteSize = 0&
  81.     If RasterCapability And RC_PALETTE Then
  82.         PaletteSize = GetCaps(SIZEPALETTE)
  83.     End If
  84. End Property
  85.  
  86. Property Get RasterCapability() As Long
  87.     RasterCapability = GetCaps(RASTERCAPS)
  88. End Property
  89.  
  90. Property Get CurveCapability() As Long
  91.     CurveCapability = GetCaps(CURVECAPS)
  92. End Property
  93.  
  94. Property Get LineCapability() As Long
  95.     LineCapability = GetCaps(LINECAPS)
  96. End Property
  97.  
  98. Property Get PolygonCapability() As Long
  99.     PolygonCapability = GetCaps(POLYGONALCAPS)
  100. End Property
  101.  
  102. Property Get TextCapability() As Long
  103.     TextCapability = GetCaps(TEXTCAPS)
  104. End Property
  105.  
  106. Property Get TransparentBlt() As Boolean
  107.     TransparentBlt = GetCaps(CAPS1) And C1_TRANSPARENT
  108. End Property
  109.  
  110. #If fComponent = 0 Then
  111. Private Sub ErrRaise(e As Long)
  112.     Dim sText As String, sSource As String
  113.     If e > 1000 Then
  114.         sSource = App.ExeName & ".Video"
  115.         Select Case e
  116.         Case eeBaseVideo
  117.             BugAssert True
  118.        ' Case ee...
  119.        '     Add additional errors
  120.         End Select
  121.         Err.Raise COMError(e), sSource, sText
  122.     Else
  123.         ' Raise standard Visual Basic error
  124.         sSource = App.ExeName & ".VBError"
  125.         Err.Raise e, sSource
  126.     End If
  127. End Sub
  128. #End If
  129.  
  130.